package com.collection.treemaps;

import java.util.TreeMap;

public class CheckValueOfTreeMapExample {
	public static void main(String[] args) {
		   
	    //create TreeMap object
	    TreeMap treeMap = new TreeMap();
	   
	    //add key value pairs to TreeMap
	    treeMap.put("1","One");
	    treeMap.put("2","Two");
	    treeMap.put("3","Three");
	   
	    /*
	      To check whether a particular value exists in TreeMap use
	      boolean containsValue(Object key) method of TreeMap class.
	      It returns true if the value is mapped to one or more keys in the
	      TreeMap otherwise false.
	    */
	   
	    boolean blnExists = treeMap.containsValue("Three");
	    System.out.println("Three exists in TreeMap ? : " + blnExists);
	  }
}
